/**
 * 获取文件类型
 * @param {String} name -文件名称
 * @return {String}
 * */
export default name => {
    const img = ['jpg', 'jpeg', 'png', 'webp', 'gif', 'svg', 'bpg']
    const video = ['avi', 'wmv', 'mpeg', 'mp4', 'mov', 'mkv', 'flv', 'f4v', 'm4v', 'rmvb', 'rm', '3gp', 'dat', 'ts', 'mts', 'vob']
    const audio = ['ogg', 'mp3', 'wav', 'mp3pro', 'wma', 'asf']
    if (name) {
        let na = name.split('?')[0].split('.')
        const len = na.length
        let t = na[len - 1].toLowerCase()
        const types = {
            img,
            video,
            audio
        }
        for (let i in types) {
            if (types[i].includes(t)) {
                return i
            }
        }
    } else {
        return 'none'
    }
}
